package entities;

import java.io.Serializable;

/**
 *
 * @author Dragan Sahpaski
 */
public class Atribute implements Serializable {

    // TODO to add atribute type
    private String name;
    // Number of distinct values of this atribute in relation
    private long numberOfDistinctValues;
    // The relation to witch this atribute belongs
    private Table table;
    private boolean isMeasure;
    private Index index;

    public Atribute(String name) {
        this(name, null, 0);
    }

    public Atribute(String name, Table table, int numberOfDistinctValues) {
        this.name = name;
        this.table = table;
        this.numberOfDistinctValues = numberOfDistinctValues;
        isMeasure = false;
    }

    public String getName() {
        return name;
    }

    public long getNumberOfDistinctValues() {
        return numberOfDistinctValues;
    }

    public Table getTable() {
        return table;
    }

    public void setTable(Table table) {
        this.table = table;
    }

    public void setNumberOfDistinctValues(long numberOfDistinctValues) {
        this.numberOfDistinctValues = numberOfDistinctValues;
    }

    public int getSizeInBytes() {
        return 20;
    }

    public boolean isIsMeasure() {
        return isMeasure;
    }

    public void setIsMeasure(boolean isMeasure) {
        this.isMeasure = isMeasure;
    }

    protected Index getIndex() {
        return index;
    }

    public void setIndex(Index index) {
        this.index = index;
    }

    @Override
    public String toString() {
        return this.name;
    }
}
